Crate borsh

Source
Expand description

§Crate features

§Ecosystem features

  • std - When enabled, borsh uses the standard library. Disabling this feature will result in building the crate in no_std environment.

    To carter such builds, Borsh offers io module which includes a items which are used in BorshSerialize and BorshDeserialize traits. Most notably io::Read, io::Write and io::Result.

    When std feature is enabled, those items are re-exports of corresponding std::io items. Otherwise they are borsh-specific types which mimic behaviour of corresponding standard types.

§Default features

  • std - enabled by default.

§Other features

§Config aliases

Re-exports§

Modules§

  • Subset of std::io which is used as part of borsh public API.
  • Module is available if borsh is built with features = ["unstable__schema"].

Functions§

  • Returns the largest possible size of a serialised object based solely on its type T.
  • Serializes an object without allocation to compute and return its length
  • generate BorshSchemaContainer for type T
  • Serialize an object into a vector of bytes.
  • Serializes an object directly into a Writer.
  • Deserialize this instance from a slice of bytes, but assume that at the beginning we have bytes describing the schema of the type. We deserialize this schema and verify that it is correct.
  • Serialize object into a vector of bytes and prefix with the schema serialized as vector of bytes in Borsh format.

Derive Macros§

  • Derive macro available if borsh is built with features = ["derive"].
  • Derive macro available if borsh is built with features = ["unstable__schema"].
  • Derive macro available if borsh is built with features = ["derive"].